Skip to content

Give chung_lu() objects class undirected_chung_lu - #69

Draft
alexpghayes wants to merge 1 commit into
mainfrom
fix/chung-lu-class
Draft

alexpghayes wants to merge 1 commit into
mainfrom
fix/chung-lu-class

Conversation

@alexpghayes

Copy link
Copy Markdown
Collaborator

Bug

chung_lu()'s @return says it returns an undirected_chung_lu object, but the class was never set. Chung-Lu models printed as a one-block "Undirected Degree-Corrected Stochastic Blockmodel", and print.undirected_chung_lu() was unreachable.

Fix

  • Pass subclass = "undirected_chung_lu" through dcsbm(), as planted_partition() does. The class is now c("undirected_chung_lu", "undirected_dcsbm", "undirected_factor_model").
  • Tidy print.undirected_chung_lu(): the underline matches the title, and blank lines separate the sections like the other print methods. The wording of each line is unchanged.
  • The @return doc now says it is a one-block undirected_dcsbm subclass.

Tests

New tests/testthat/test-chung-lu.R: checks the class and that print() uses the Chung-Lu method. Fails on main (3 failures), passes here. Full suite passes. Docs regenerated with roxygen2 7.3.2.

Note for #60

#60's test-print-methods.R calls print.undirected_chung_lu(m) directly, with a comment that chung_lu() objects dispatch to the DC-SBM method. Once this is merged, that test can use plain print(m) and drop the comment. Its assertions should still pass, since the line text is unchanged.

NEWS

Left out to avoid conflicting with #59. Suggested bullet under Bug fixes:

  • chung_lu() now returns an object with class undirected_chung_lu (on top of undirected_dcsbm), as documented, so it prints as a Chung-Lu graph rather than a one-block DC-SBM.

🤖 Generated with Claude Code

chung_lu() documented that it returns an `undirected_chung_lu` object,
but never set that class, so it printed as a one-block DC-SBM and
print.undirected_chung_lu() was unreachable. Pass the subclass through
dcsbm(), as planted_partition() does, and tidy the print method's
spacing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant